<template>
    <div>
        <yw-header></yw-header>
        <div class="main">
            <ul class="announcement-list">
                <li v-for="(item,index) in AnnounCeMent" :key="index" @click="ggLink(item)">
                    <h3>{{item.title}}</h3>
                    <p class="breviary">{{item.contentTitle}}</p>
                    <p class="time">{{$time(item.createTime)}}</p>
               </li>
            </ul>
            <div class="page-layout">
                <Page :total="total" show-elevator  @on-change="change" />
            </div>
        </div>
        <yw-footer></yw-footer>
    </div>
</template>
<script>

import header from '../common/header'
import footer from '../common/footer'
import apiHttp from '../../api/index'
export default {
  data() {
    return {
      page:0,
      size:10,
      AnnounCeMent:[],
      total:0
    }
  },
  //页面加载
  mounted:function(){
    this.getAnnounCeMentPage();
  },
  methods: {
    //查询公告列表
    getAnnounCeMentPage(){
      let that = this;
      let data={
        page:that.page,
        size:that.size
      }
      apiHttp.apiGg.getAnnounCeMentPage('',data,resp=>{
        if(resp.code==200&&resp.data!=null&&resp.data!=undefined){
          that.AnnounCeMent=resp.data.content;
          that.total = resp.data.totalElements
        }
      });
    },
    ggLink(item){
      this.$router.push({
        name:'ggListDetail',
        query:{
          id:item.id
        }
      })
    },
    // 分页
    change(index){
        this.page = index - 1
        this.getAnnounCeMentPage()
    }

  },


    components:{
        'yw-header':header,
        'yw-footer':footer,
    }
}
</script>
